how to get minimum element of stack